//
//  PObject.cpp
//  Prism
//
//  Created by Bas du Pre on 20-05-11.
//  Copyright 2011 UU. All rights reserved.
//

#include "global.h"
#include "PObject.h"
#include "PString.h"

using namespace Prism;

PObject::PObject() {
    //POBJECT_events = new NoPObjectList<BaseEvent*>();
    this->native_init();
}

PObject::~PObject() {
    this->native_deInit();
    for (unsigned int i = 0; i < POBJECT_events.length(); i++)
    {
        POBJECT_events[i]->removeHandler(this);
    }
    //delete POBJECT_events;
}

void PObject::linkEvent(BaseEvent *event) {
    this->POBJECT_events.pushBack(event);
}

void PObject::unlinkEvent(BaseEvent *event) {
    this->POBJECT_events.remove(event);
}

void PObject::native_init() { }
void PObject::native_deInit() { }

String PObject::toString() { return String("[PObject]"); } 
